<?php
/* Smarty version 3.1.31, created on 2018-04-12 06:08:04
  from "/opt/lampp/htdocs/pro/app/view/admin/activity.html" */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.31',
  'unifunc' => 'content_5acedba4c0d144_15741263',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'e0b89098b7f3e004fc0830c976a67faaf619b7ea' => 
    array (
      0 => '/opt/lampp/htdocs/pro/app/view/admin/activity.html',
      1 => 1523506011,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_5acedba4c0d144_15741263 (Smarty_Internal_Template $_smarty_tpl) {
if (!is_callable('smarty_modifier_date_format')) require_once '/opt/lampp/htdocs/pro/vendor/smarty/smarty/libs/plugins/modifier.date_format.php';
$_smarty_tpl->_loadInheritance();
$_smarty_tpl->inheritance->init($_smarty_tpl, true);
?>

<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_13747620605acedba47476c7_47175034', "content");
?>

<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_3355491975acedba4b1c3f3_62816942', "js");
?>

<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl, 'layout/layout.html');
}
/* {block "content"} */
class Block_13747620605acedba47476c7_47175034 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content' => 
  array (
    0 => 'Block_13747620605acedba47476c7_47175034',
  ),
);
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
?>

<div class="hastable">

    <div style="margin-bottom: 10px">
        <label class="btn btn-success btn-sm" onclick=goback("/admin/createactivity")><i class="fa fa-plus"></i>创建活动</label>
        <label class="btn btn-danger btn-sm" onclick="delall()"><i class="fa fa-remove"></i>批量删除</label>
    </div>

    <div style="margin-bottom: 10px">
        <label style="margin-right: 10px">活动名称:</label><input style="margin-right: 10px" type="text" name="search" value="<?php echo (($tmp = @$_smarty_tpl->tpl_vars['search']->value)===null||$tmp==='' ? '' : $tmp);?>
">
        <label style="margin-right: 10px">适合年龄:</label><input style="margin-right: 10px;width: 100px" value="<?php echo (($tmp = @$_smarty_tpl->tpl_vars['minage']->value)===null||$tmp==='' ? '' : $tmp);?>
" type="text" name="minage"><label style="margin-right: 10px">~</label><input value="<?php echo (($tmp = @$_smarty_tpl->tpl_vars['maxage']->value)===null||$tmp==='' ? '' : $tmp);?>
" style="margin-right: 10px;width: 100px" type="text" name="maxage">
        <label style="margin-right: 10px">活动时间:</label><input readonly class="datepicker" style="margin-right: 10px;width: 100px" type="text" value="<?php echo (($tmp = @$_smarty_tpl->tpl_vars['starttime']->value)===null||$tmp==='' ? '' : $tmp);?>
" name="starttime"><label style="margin-right: 10px">~</label><input readonly class="datepicker" value="<?php echo (($tmp = @$_smarty_tpl->tpl_vars['endtime']->value)===null||$tmp==='' ? '' : $tmp);?>
" style="margin-right: 10px;width: 100px" type="text" name="endtime">
        <label class="btn btn-success btn-sm" onclick="doserch()"><i class="fa fa-search"></i>检索</label>
        <label class="btn btn-success btn-sm" onclick="reset()"><i class="fa fa-remove"></i>清空</label>
    </div>

    <table>
        <thead>
        <tr>
            <th><input value="check_none" onclick="checkall(this)" class="submit" type="checkbox">
            </th>
            <th>活动名称</th>
            <th>适合年龄</th>
            <th>活动时间</th>
            <th>已报名家庭/招募家庭</th>
            <th>积分兑换</th>
            <th style="width:132px">操作</th>
        </tr>
        </thead>
        <tbody>
        <?php if (count($_smarty_tpl->tpl_vars['data']->value) != 0) {?>
        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['data']->value, 'value', false, 'key');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['key']->value => $_smarty_tpl->tpl_vars['value']->value) {
?>
        <tr class="<?php if ($_smarty_tpl->tpl_vars['key']->value%2 != 0) {?>even<?php } else { ?>odd<?php }?>">
            <td class="center"><input value="<?php echo $_smarty_tpl->tpl_vars['value']->value['id'];?>
" name="list" class="checkbox" type="checkbox"></td>
            <td><?php echo (($tmp = @$_smarty_tpl->tpl_vars['value']->value['activityname'])===null||$tmp==='' ? '' : $tmp);?>
</td>
            <td><?php echo (($tmp = @$_smarty_tpl->tpl_vars['value']->value['minage'])===null||$tmp==='' ? '' : $tmp);?>
~<?php echo (($tmp = @$_smarty_tpl->tpl_vars['value']->value['maxage'])===null||$tmp==='' ? '' : $tmp);?>
</td>
            <td>
                <?php echo (($tmp = @smarty_modifier_date_format($_smarty_tpl->tpl_vars['value']->value['starttime'],'%Y-%m-%d'))===null||$tmp==='' ? '' : $tmp);?>
~<?php echo (($tmp = @smarty_modifier_date_format($_smarty_tpl->tpl_vars['value']->value['endtime'],'%Y-%m-%d'))===null||$tmp==='' ? '' : $tmp);?>

            </td>
            <td><?php echo (($tmp = @$_smarty_tpl->tpl_vars['value']->value['joinnum'])===null||$tmp==='' ? 0 : $tmp);?>
/<?php echo (($tmp = @$_smarty_tpl->tpl_vars['value']->value['maxnum'])===null||$tmp==='' ? 0 : $tmp);
if ($_smarty_tpl->tpl_vars['value']->value['joinnum'] != 0) {?><a style="margin-left: 10px;cursor: pointer" href="/"><i class="fa fa-download"></i></a><?php }?></td>
            <td><?php echo (($tmp = @$_smarty_tpl->tpl_vars['value']->value['maxintegral'])===null||$tmp==='' ? '' : $tmp);?>
</td>
            <td>
                <a class="btn_no_text btn ui-state-default ui-corner-all tooltip" href="/admin/createactivity/<?php echo $_smarty_tpl->tpl_vars['value']->value['id'];?>
">
                    <span class="ui-icon ui-icon-wrench"></span>
                </a>
                <a class="btn_no_text btn ui-state-default ui-corner-all tooltip" attrid="<?php echo $_smarty_tpl->tpl_vars['value']->value['id'];?>
" onclick="rmrow(this)" href="javascript:void(0)">
                    <span class="ui-icon ui-icon-circle-close"></span>
                </a>
            </td>
        </tr>
        <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);
?>

        <?php } else { ?>
        <tr class="even">
            <td colspan="7" style="text-align: center">无内容</td>
        </tr>
        <?php }?>

        </tbody>

    </table>

    <ul style="width:50%;margin: 0 auto;text-align: center" id="pagination"></ul>

</div>
<div class="clearfix"></div>

<?php
}
}
/* {/block "content"} */
/* {block "js"} */
class Block_3355491975acedba4b1c3f3_62816942 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'js' => 
  array (
    0 => 'Block_3355491975acedba4b1c3f3_62816942',
  ),
);
public $append = 'true';
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
?>

<?php echo '<script'; ?>
 type="text/javascript">

    $(function () {
        init()
    })
    function init() {
        $(".datepicker").datepicker({
            dateFormat: "yy-mm-dd",
            showOtherMonths: true,
            selectOtherMonths: true,
            showButtonPanel: true,
            showOn: "both",
            buttonImageOnly: true,
            buttonText: "",
            changeMonth: true,
            changeYear: true
        });
        <?php if (count($_smarty_tpl->tpl_vars['data']->value) != 0) {?>
        $("#pagination").twbsPagination("destroy");
        $('#pagination').twbsPagination({
            startPage: parseInt("<?php echo (($tmp = @$_smarty_tpl->tpl_vars['page']->value)===null||$tmp==='' ? 1 : $tmp);?>
"),
            initiateStartPageClick: false,
            totalPages: parseInt("<?php echo $_smarty_tpl->tpl_vars['total']->value;?>
"),
            visiblePages: 10,
            first: '首页',
            last: '尾页',
            prev: '«',
            next: '»',
            paginationClass: '',
            nextClass: 'next',
            prevClass: '',
            lastClass: '',
            firstClass: '',
            pageClass: '',
            activeClass: 'active',
            disabledClass: 'previous-off',
            anchorClass: '',
            onPageClick: function (event, pager) {

                var data = {page: parseInt("<?php echo (($tmp = @$_smarty_tpl->tpl_vars['page']->value)===null||$tmp==='' ? 1 : $tmp);?>
")};
                window.location.href = '/admin/activity/' + $.base64.btoa(JSON.stringify(data));

            }

        });
        <?php }?>
    }
    function doserch() {
        var search = $("input[name='search']").val();
        var minage = $("input[name='minage']").val();
        var maxage = $("input[name='maxage']").val();
        var starttime = $("input[name='starttime']").val();
        var endtime = $("input[name='endtime']").val();
        var data = {
            search: search,
            minage: minage,
            maxage: maxage,
            starttime: starttime,
            endtime: endtime,
            page: parseInt("<?php echo (($tmp = @$_smarty_tpl->tpl_vars['page']->value)===null||$tmp==='' ? 1 : $tmp);?>
")
        };
        window.location.href = '/admin/activity/' + $.base64.btoa(JSON.stringify(data));

    }
    function reset() {
        $("input[name='search']").val('');
        $("input[name='minage']").val('');
        $("input[name='maxage']").val('');
        $("input[name='starttime']").val('');
        $("input[name='endtime']").val('');
        window.location.href = '/admin/activity';
    }
    function rmrow(obj) {
        var id= obj.getAttribute('attrid');
       $.post('/api/deleteactivity.json',{id:id},function (data, textStatus, jqXHR) {
          if(jqXHR.status==200){
              showmsg(jqXHR.responseText, 1);
              window.location.reload();

          }else{
              showmsg(jqXHR.responseText, 2);
          }
       });




    }
    function delall() {
        var id=[];
        $("input[name='list']").each(function (k,v) {
            if(v.checked){
                id.push(parseInt(v.value))
            }
        })
        if(id.length>0){
            $.post('/api/deleteactivity.json',{id:id.join(',')},function (data, textStatus, jqXHR) {
                if(jqXHR.status==200){
                    showmsg(jqXHR.responseText, 1);
                    window.location.reload();

                }else{
                    showmsg(jqXHR.responseText, 2);
                }
            });
        }else{
            showmsg('请选择要删除的活动', 2);
        }


    }

<?php echo '</script'; ?>
>
<?php
}
}
/* {/block "js"} */
}
